{***************************************************************************}
{                                                                           }
{           DUnitX                                                          }
{                                                                           }
{           Copyright (C) 2013 Vincent Parrett                              }
{                                                                           }
{           vincent@finalbuilder.com                                        }
{           http://www.finalbuilder.com                                     }
{                                                                           }
{                                                                           }
{***************************************************************************}
{                                                                           }
{  Licensed under the Apache License, Version 2.0 (the "License");          }
{  you may not use this file except in compliance with the License.         }
{  You may obtain a copy of the License at                                  }
{                                                                           }
{      http://www.apache.org/licenses/LICENSE-2.0                           }
{                                                                           }
{  Unless required by applicable law or agreed to in writing, software      }
{  distributed under the License is distributed on an "AS IS" BASIS,        }
{  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. }
{  See the License for the specific language governing permissions and      }
{  limitations under the License.                                           }
{                                                                           }
{***************************************************************************}

unit DUnitX.Options;

interface

type
  TDUnitXOptions = class
  public
    class var
      //The xml output file to be generated by xml loggers
      XMLOutputFile : string;
      // Specifiy the tests to run.
      Run : string;

      //the name of a file which lists the tests to run.
      RunListFile : string;
  end;


implementation

uses
  DUnitX.CommandLine.Options;


procedure RegisterOptions;
var
  def : IOptionDefintion;
begin
  //enable passing an options file containing options.
  def := TOptionsRegistry.RegisterOption<string>('options','opt','Options File',nil);
  def.IsOptionFile := true;

  TOptionsRegistry.RegisterOption<string>('xmlfile','xml','XML output file path',
                                          procedure(value :string)
                                          begin
                                             TDUnitXOptions.XMLOutputFile = value;
                                          end);

  TOptionsRegistry.RegisterOption<string>('runlist','rl','Specify the name of a file which lists the tests to run.',
                                          procedure(value :string)
                                          begin
                                             TDUnitXOptions.RunListFile = value;
                                          end);

  TOptionsRegistry.RegisterOption<string>('run','r','Specify the tests to run, separate by commas',
                                          procedure(value :string)
                                          begin
                                             TDUnitXOptions.RunListFile = value;
                                          end);

end;

initialization
  RegisterOptions;
end.
